const s1 = Symbol('独一无二的值')
const s2 = Symbol('独一无二的值')

console.log('s1: ', s1) //=> Symbol(独一无二的值)
console.log('typeof s1: ', typeof s1) //=> symbol
console.log('s1 == s2: ', s1 == s2) //=> false

const Bob = {
  name: 'Bob',
  id: '101'
}
const s3 = Symbol(Bob)
console.log('s3: ', s3) //=> Symbol([object Object])

// console.log(new Symbol()) //=> TypeError: Symbol is not a constructor

s1.id = 's101'
console.log('s1: ', s1) //=> Symbol(独一无二的值)

console.log('===运算===')
// console.log(s1 + 1) //=> TypeError: Cannot convert a Symbol value to a number
// console.log(s1 + '1') //=> TypeError: Cannot convert a Symbol value to a TypeError: Cannot convert a Symbol value to a string

console.log(String(s1)) //=> 'Symbol(101)'
console.log(s1.toString()) //=> 'Symbol(101)'
console.log(Boolean(s1)) //=> true
console.log(!s1) //=> false
console.log(!!s1) //=> true
// console.log(Number(s1)) //=> TypeError: Cannot convert a Symbol value to a number
// console.log(s1 + 1) //=> TypeError: Cannot convert a Symbol value to a number
